package com.jinmdz.fmis.api.api.controller;

import com.jinmdz.fmis.api.api.model.calcrule.CalcRuleData;
import com.jinmdz.fmis.api.api.service.CalcRuleService;
import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 计算规则相关接口
 *
 * @author LiCongLu
 * @date 2020-04-07 13:44
 */
@Api(description = "计算规则相关接口")
@RestController()
@RequestMapping("/api/calc-rule")
public class CalcRuleController extends BaseController {

    @Resource
    private CalcRuleService calcRuleService;

    /**
     * 按照计算规则加载费用
     *
     * @param data 计算规则
     * @return
     * @author LiCongLu
     * @date 2020-04-07 13:55
     */
    @ApiOperation(value = "按照计算规则加载费用", notes = "按照计算规则加载费用")
    @PostMapping("/load-charge-with-rule")
    public BaseResult<String> loadChargeWithRule(@RequestBody CalcRuleData data) {
        return resultHandler(data, userItem -> calcRuleService.loadChargeWithRule(data));
    }

}
